﻿#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main() {
    // 使用vector
    std::vector<int> numbers = { 3, 1, 4, 1, 5, 9, 2, 6 };
    sort(numbers.begin(), numbers.end());
 
    for ( int item : numbers)
    {
        cout<< "值为" << item << endl; 
    }
 
 
    std::cout << "Original vector: ";
    for (int num : numbers) 
    {
        std::cout << num << " ";
    }
    std::cout << std::endl;

    // 排序
    std::sort(numbers.begin(), numbers.end());

    std::cout << "Sorted vector: ";
    for (int num : numbers) {
        std::cout << num << " ";
    }
    std::cout << std::endl;

    // 使用map
    std::map<std::string, int> ages;
    ages["Alice"] = 25;
    ages["Bob"] = 30;
    ages["Charlie"] = 35;

    std::cout << "\nAge map:" << std::endl;
    for (const auto& pair : ages) {
        std::cout << pair.first << ": " << pair.second << std::endl;
    }

    return 0;
}